package com.elite.service;

import com.elite.dao.PreorderMapper;
import com.elite.entity.Preorder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by hbl on 2017/2/18.
 */
@Service("PreorderService")
public class PreorderServiceImpl implements PreorderService {
    @Autowired
    PreorderMapper preorderMapper;

    @Override
    public void insertAll(Preorder preorder) {
        preorderMapper.insert(preorder);
    }

    @Override
    public List<Preorder> getAll() {
        List<Preorder> preorders = preorderMapper.select();
        return preorders;
    }

    @Override
    public void changeById(Preorder preorder) {
        preorderMapper.updateByPrimaryKeySelective(preorder);
    }

    @Override
    public void changeStatusById(Preorder preorder) {
        preorderMapper.updateByPrimaryKeySelective(preorder);

    }

    @Override
    public Preorder selectById(Integer preorderId) {
        return preorderMapper.selectByPrimaryKey(preorderId);
    }
}
